/*
 * @Author: qwlbwm 18370818801qwl./
 * @Date: 2023-09-06 09:12:16
 * @LastEditors: whereamazinghappen 306702547@qq.com
 * @LastEditTime: 2023-09-18 10:41:17
 * @FilePath: \checc-business-module-web-kgpt-dev\src\api\examineManage.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'
import { ObjectType, ResponseDataPromise } from 'typings/interfaces'
import * as proxy from '@/constants/proxy'
import { exportMethod } from '@/utils/utils';

//各单位年度考核
//-------------------------- 外层列表 ↓↓↓
export const getEveryList = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/pageList',
    method: 'post',
    data,
})
//--批量导出
// export const exportStandardIndexRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
// request({
//     url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/export',
//     method: 'post',
//     data,
//     responseType: 'blob'
// })
export function exportStandardIndexRequest(data: any) {
    const params = {
      url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/export',
      method:'post',
      data,
      fileName: '各单位年度考核表格',
     }
    return exportMethod(params)
}

//批量下发
export const distributeIndexRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/distribute',
    method: 'post',
    data,
})
//批量开启考核
export const startAssessmentRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/openExamine',
    method: 'post',
    data,
})
//批量开启考核
export const deleteRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/delete',
    method: 'post',
    data,
})
//考核详情
export const getFaNumber = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/detail',
    method: 'post',
    data,
})
//退回
export const withdrawRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/applyRollback',
    method: 'post',
    data,
})
//退回
export const withoutRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/distributeReverse',
    method: 'post',
    data,
})
//下载全部附件
export const downAllRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/downloadAllAttachment',
    method: 'post',
    data,
})
//查看报告
export const lookreportRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank-report/list',
    method: 'post',
    data,
})
//集团审核
export const jituanRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/submitTotalAudit',
    method: 'post',
    data,
})
//报告上传
export const uploadreportRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank-report/mySave',
    method: 'post',
    data,
})
//删除报告
export const deletereportRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank-report/delete',
    method: 'post',
    data,
})
//本单位年度考核
//-------------------------- 外层列表 ↓↓↓
export const getMyList = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/pageMyUnitList',
    method: 'post',
    data,
})
//自评录入-------保存
export const saveExamine = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/selfInput',
    method: 'post',
    data,
})
//提交内审
export const subWithinRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/submitInternalAudit',
    method: 'post',
    data,
})
//审核
export const toExamine = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/doInternalAudit',
    method: 'post',
    data,
})
//提交集团审核
export const toGroupExamine = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/submitTotalAudit',
    method: 'post',
    data,
})
//申请退回
export const applyBack = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/applyRollback',
    method: 'post',
    data,
})
//企业对标---企业列表
export const getAssment = (): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/my-index-annual-examine/getCompanyList',
    method: 'get',
})//企业对标---企业列表
export const getAssment3 = (id): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + `/khgl/my-index-annual-examine/getCompanyList3?id=${id}`,
    method: 'get',
})
//企业对标--详情 compare
export const getCompare = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-company-bank/compare',
    method: 'post',
    data,
})
